Lambda Custom Runtime via Docker Support #1246
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
AWS Lambda introduced container support for custom runtimes (see https://www.serverless.com/blog/container-support-for-lambda). The
serverless
configuration prevents you from using ahandler
property in your function definitions when you use theimage
property. Currentlyserverless-offline
will result in the following error using theaws-nodejs-docker
serverless template with the latestserverless-offline@7.0.0
andserverless-webpack@5.5.1
.Motivation and Context
See my related contribution to
serverless-webpack
: serverless-heaven/serverless-webpack#723How Has This Been Tested?
I started by locally leveraging
yalc
to mock published changes on my branch.I then created a new serverless project via a template.
From the test project directory, I then added dev dependencies.
Next I linked my local
serverless-offline
package to my test project withyalc
I added a new file called
webpack.config.js
.babelrc
file for babelI then registered the serverless plugins by modifying the
serverless.yml
to include aplugins
sectionI also modified the
functions
section ofserverless.yml
to include theimage.command
property (required byserverless-webpack
) and an HTTP event.In the
app.js
file I converted themodule.exports
syntax toexport const
.Finally I ran
yarn sls offline start
and then ran acurl
command against the example HTTP route.Unit Test Results:
E2E Test Results